<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('学生项目管理')"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="data-form">
                <div class="select-list">
                    <ul>
                        <li>
                            学生姓名：<input type="text" name="childName"/>
                        </li>

                        <li>
                            课程名称：<select name="scheduleType"
                                         th:with="type=${@dict.getType('business_schedule_type')}">
                            <option value="">全部</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}">
                            </option>
                        </select>
                        </li>
                    </ul>
                    <ul>
                        <li>
                            <label>时间：</label>
                            <div class="input-group date">
                                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                <input type="text" class="col-sm-3 control-label" id="laydate-demo-1" placeholder="yyyy-MM-dd">
                            </div>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    // 权限
    var editFlag = [[${@permission.hasPermi('business:childSchedule:edit')}]];
    var showFlag = [[${@permission.hasPermi('business:childSchedule:show')}]];

    // 字典
    var startType = [[${@dict.getType('sys_start_type')}]];
    var prefix = ctx + "business/childSchedule";

    $(function(){
        layui.use('laydate', function(){
            layui.laydate.render({
                elem: '#laydate-demo-1',
                value: new Date(),
                format: 'yyyy-MM',
                type: 'month'
            });
        })
    });

    $(function () {
        var options = {
            url: prefix + "/list",
            updateUrl: prefix + "/edit/{id}",
            modalName: "数据",
            columns: [{
                checkbox: true
            },
                {
                    field: 'childName',
                    title: '学员姓名',
                },
                {
                    field: 'start',
                    title: '状态',
                    align: "center",
                    formatter: function (value, row, index) {
                        if ($.common.isNotEmpty(value)) {
                            return $.table.selectDictLabel(startType, value);
                        } else {
                            return null;
                        }
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (row.day < 3) {
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.studentId + '\')"><i class="fa fa-edit"></i>编辑</a>');
                        } else {
                            actions.push('<a class="btn btn-primary single disabled"> <i class="fa fa-edit"></i> 编辑</a>');
                        }
                        actions.push('<a class="btn btn-success btn-xs ' + showFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.studentId + '\')"><i class="fa fa-edit"></i>查看</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });



</script>
</body>

</html>